package com.bocai.freeman.view.activitys;

import android.content.Intent;
import android.os.Bundle;
import android.widget.EditText;
import android.widget.TableRow;
import android.widget.TextView;

import com.bocai.freeman.R;
import com.bocai.freeman.base.BaseActivity;
import com.bocai.freeman.utils.ToolbarHelper;

import butterknife.Bind;
import butterknife.ButterKnife;

/**
 * Created by win7 on 2016/5/25.
 */
public class PersonDataEditActivity extends BaseActivity {

    @Bind(R.id.tv_nickname)
    TextView mTvNickname;
    @Bind(R.id.tr_nickname)
    TableRow mTrNickname;
    @Bind(R.id.tv_birth)
    TextView mTvBirth;
    @Bind(R.id.tr_birth)
    TableRow mTrBirth;
    @Bind(R.id.tv_ads)
    TextView mTvAds;
    @Bind(R.id.tr_ads)
    TableRow mTrAds;
    @Bind(R.id.tv_gender)
    TextView mTvGender;
    @Bind(R.id.tr_gender)
    TableRow mTrGender;
    @Bind(R.id.tv_height)
    TextView mTvHeight;
    @Bind(R.id.tr_height)
    TableRow mTrHeight;
    @Bind(R.id.tv_weight)
    TextView mTvWeight;
    @Bind(R.id.tr_weight)
    TableRow mTrWeight;
    @Bind(R.id.tv_profession)
    TextView mTvProfession;
    @Bind(R.id.tr_profession)
    TableRow mTrProfession;
    @Bind(R.id.tv_spare_time)
    TextView mTvSpareTime;
    @Bind(R.id.tr_spare_time)
    TableRow mTrSpareTime;
    @Bind(R.id.tv_sign)
    TextView mTvSign;
    @Bind(R.id.tr_personal_sign)
    TableRow mTrPersonalSign;
    @Bind(R.id.tv_emotional)
    TextView mTvEmotional;
    @Bind(R.id.tr_emotional_state)
    TableRow mTrEmotionalState;
    @Bind(R.id.et_explanation)
    EditText mEtExplanation;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_person_data_edit);
        ButterKnife.bind(this);
        initEvent();
    }

    @Override
    protected void initEvent() {
        super.initEvent();
        ToolbarHelper.setup(this, getString(R.string.str_edit_data), R.mipmap.left_return,
                R.menu.menu_compelet, v -> onBackPressed(), item -> {
                    showToast("完成");
                    return true;
                });

        click(mTrNickname).subscribe(o -> {
            Intent intent = new Intent(PersonDataEditActivity.this, PersonalEditActivity.class);
            intent.putExtra("theme", getString(R.string.modify_nickname));
            startActivityForResult(intent, ITEM_THEME.NICKNAME.ordinal());
        });


        click(mTrGender).subscribe(o1 -> {
            startActivityForResult(new Intent(PersonDataEditActivity.this,EditGenderActivity.class),ITEM_THEME.GENDER.ordinal());
        });

        click(mTrBirth).subscribe(o1 -> {
            startActivityForResult(new Intent(PersonDataEditActivity.this,EditAgeActivity.class),ITEM_THEME.AGE.ordinal());
        });

    }

    public enum ITEM_THEME{
        NICKNAME,
        NAME,
        GALLERY,
        PHOTOGRAPH,
        PHOTOZOOM,
        GENDER,
        AGE
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        ButterKnife.unbind(this);
    }
}
